package com.nbsaas.boot.ai.rest.convert;

import com.nbsaas.boot.ai.data.entity.AiAgentConfig;
import com.nbsaas.boot.ai.api.domain.response.AiAgentConfigResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;

import java.util.HashMap;
import java.util.Map;

/**
 * 智能体配置-实体对象转化成响应对象
 */

public class AiAgentConfigResponseConvert implements Converter<AiAgentConfigResponse, AiAgentConfig> {

    @Override
    public AiAgentConfigResponse convert(AiAgentConfig source) {
        AiAgentConfigResponse result = new AiAgentConfigResponse();
        BeanDataUtils.copyProperties(source, result);
        if (source.getEnabled() != null) {
            Map<Integer, String> EnabledMap = new HashMap<>();
            EnabledMap.put(1, "启用");
            EnabledMap.put(-1, "禁用");
            String label = EnabledMap.get(source.getEnabled());
            result.setEnabledName(label);
        }
        result.setEnabled(source.getEnabled());
        return result;
    }

}

